import 'package:healthy_station_flutter/generated/json/base/json_convert_content.dart';
import 'package:healthy_station_flutter/entity/id_card_entity.dart';

IdCardEntity $IdCardEntityFromJson(Map<String, dynamic> json) {
  final IdCardEntity idCardEntity = IdCardEntity();
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    idCardEntity.name = name;
  }
  final String? gender = jsonConvert.convert<String>(json['gender']);
  if (gender != null) {
    idCardEntity.gender = gender;
  }
  final String? group = jsonConvert.convert<String>(json['group']);
  if (group != null) {
    idCardEntity.group = group;
  }
  final String? born = jsonConvert.convert<String>(json['born']);
  if (born != null) {
    idCardEntity.born = born;
  }
  final String? address = jsonConvert.convert<String>(json['address']);
  if (address != null) {
    idCardEntity.address = address;
  }
  final String? idNumber = jsonConvert.convert<String>(json['idNumber']);
  if (idNumber != null) {
    idCardEntity.idNumber = idNumber;
  }
  final String? startDate = jsonConvert.convert<String>(json['startDate']);
  if (startDate != null) {
    idCardEntity.startDate = startDate;
  }
  final String? endDate = jsonConvert.convert<String>(json['endDate']);
  if (endDate != null) {
    idCardEntity.endDate = endDate;
  }
  final String? issueAuthority = jsonConvert.convert<String>(
      json['issueAuthority']);
  if (issueAuthority != null) {
    idCardEntity.issueAuthority = issueAuthority;
  }
  final String? keyString = jsonConvert.convert<String>(json['keyString']);
  if (keyString != null) {
    idCardEntity.keyString = keyString;
  }
  return idCardEntity;
}

Map<String, dynamic> $IdCardEntityToJson(IdCardEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['name'] = entity.name;
  data['gender'] = entity.gender;
  data['group'] = entity.group;
  data['born'] = entity.born;
  data['address'] = entity.address;
  data['idNumber'] = entity.idNumber;
  data['startDate'] = entity.startDate;
  data['endDate'] = entity.endDate;
  data['issueAuthority'] = entity.issueAuthority;
  data['keyString'] = entity.keyString;
  return data;
}

extension IdCardEntityExtension on IdCardEntity {
  IdCardEntity copyWith({
    String? name,
    String? gender,
    String? group,
    String? born,
    String? address,
    String? idNumber,
    String? startDate,
    String? endDate,
    String? issueAuthority,
    String? keyString,
  }) {
    return IdCardEntity()
      ..name = name ?? this.name
      ..gender = gender ?? this.gender
      ..group = group ?? this.group
      ..born = born ?? this.born
      ..address = address ?? this.address
      ..idNumber = idNumber ?? this.idNumber
      ..startDate = startDate ?? this.startDate
      ..endDate = endDate ?? this.endDate
      ..issueAuthority = issueAuthority ?? this.issueAuthority
      ..keyString = keyString ?? this.keyString;
  }
}